\(\int \sec ^8(c+d x) (a+a \sin (c+d x))^2 \, dx\) [26]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [C] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F(-1)]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 21, antiderivative size = 82 \[ \int \sec ^8(c+d x) (a+a \sin (c+d x))^2 \, dx=\frac {2 \sec ^7(c+d x) \left (a^2+a^2 \sin (c+d x)\right )}{7 d}+\frac {5 a^2 \tan (c+d x)}{7 d}+\frac {10 a^2 \tan ^3(c+d x)}{21 d}+\frac {a^2 \tan ^5(c+d x)}{7 d} \]

[Out]

2/7*sec(d*x+c)^7*(a^2+a^2*sin(d*x+c))/d+5/7*a^2*tan(d*x+c)/d+10/21*a^2*tan(d*x+c)^3/d+1/7*a^2*tan(d*x+c)^5/d

Rubi [A] (verified)

Time = 0.07 (sec) , antiderivative size = 82, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.095, Rules used = {2755, 3852} \[ \int \sec ^8(c+d x) (a+a \sin (c+d x))^2 \, dx=\frac {a^2 \tan ^5(c+d x)}{7 d}+\frac {10 a^2 \tan ^3(c+d x)}{21 d}+\frac {5 a^2 \tan (c+d x)}{7 d}+\frac {2 \sec ^7(c+d x) \left (a^2 \sin (c+d x)+a^2\right )}{7 d} \]

[In]

Int[Sec[c + d*x]^8*(a + a*Sin[c + d*x])^2,x]

[Out]

(2*Sec[c + d*x]^7*(a^2 + a^2*Sin[c + d*x]))/(7*d) + (5*a^2*Tan[c + d*x])/(7*d) + (10*a^2*Tan[c + d*x]^3)/(21*d
) + (a^2*Tan[c + d*x]^5)/(7*d)

Rule 2755

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_), x_Symbol] :> Simp[-2*b*(
g*Cos[e + f*x])^(p + 1)*((a + b*Sin[e + f*x])^(m - 1)/(f*g*(p + 1))), x] + Dist[b^2*((2*m + p - 1)/(g^2*(p + 1
))), Int[(g*Cos[e + f*x])^(p + 2)*(a + b*Sin[e + f*x])^(m - 2), x], x] /; FreeQ[{a, b, e, f, g}, x] && EqQ[a^2
 - b^2, 0] && GtQ[m, 1] && LtQ[p, -1] && IntegersQ[2*m, 2*p]

Rule 3852

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Dist[-d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {2 \sec ^7(c+d x) \left (a^2+a^2 \sin (c+d x)\right )}{7 d}+\frac {1}{7} \left (5 a^2\right ) \int \sec ^6(c+d x) \, dx \\ & = \frac {2 \sec ^7(c+d x) \left (a^2+a^2 \sin (c+d x)\right )}{7 d}-\frac {\left (5 a^2\right ) \text {Subst}\left (\int \left (1+2 x^2+x^4\right ) \, dx,x,-\tan (c+d x)\right )}{7 d} \\ & = \frac {2 \sec ^7(c+d x) \left (a^2+a^2 \sin (c+d x)\right )}{7 d}+\frac {5 a^2 \tan (c+d x)}{7 d}+\frac {10 a^2 \tan ^3(c+d x)}{21 d}+\frac {a^2 \tan ^5(c+d x)}{7 d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.02 (sec) , antiderivative size = 110, normalized size of antiderivative = 1.34 \[ \int \sec ^8(c+d x) (a+a \sin (c+d x))^2 \, dx=\frac {2 a^2 \sec ^7(c+d x)}{7 d}+\frac {a^2 \sec ^6(c+d x) \tan (c+d x)}{d}-\frac {5 a^2 \sec ^4(c+d x) \tan ^3(c+d x)}{3 d}+\frac {4 a^2 \sec ^2(c+d x) \tan ^5(c+d x)}{3 d}-\frac {8 a^2 \tan ^7(c+d x)}{21 d} \]

[In]

Integrate[Sec[c + d*x]^8*(a + a*Sin[c + d*x])^2,x]

[Out]

(2*a^2*Sec[c + d*x]^7)/(7*d) + (a^2*Sec[c + d*x]^6*Tan[c + d*x])/d - (5*a^2*Sec[c + d*x]^4*Tan[c + d*x]^3)/(3*
d) + (4*a^2*Sec[c + d*x]^2*Tan[c + d*x]^5)/(3*d) - (8*a^2*Tan[c + d*x]^7)/(21*d)

Maple [C] (verified)

Result contains complex when optimal does not.

Time = 0.73 (sec) , antiderivative size = 86, normalized size of antiderivative = 1.05

method result size
risch \(-\frac {16 i a^{2} \left (-8 i {\mathrm e}^{3 i \left (d x +c \right )}+14 \,{\mathrm e}^{4 i \left (d x +c \right )}-4 i {\mathrm e}^{i \left (d x +c \right )}+3 \,{\mathrm e}^{2 i \left (d x +c \right )}-1\right )}{21 \left (-i+{\mathrm e}^{i \left (d x +c \right )}\right )^{7} \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )^{3} d}\) \(86\)
derivativedivides \(\frac {a^{2} \left (\frac {\sin ^{3}\left (d x +c \right )}{7 \cos \left (d x +c \right )^{7}}+\frac {4 \left (\sin ^{3}\left (d x +c \right )\right )}{35 \cos \left (d x +c \right )^{5}}+\frac {8 \left (\sin ^{3}\left (d x +c \right )\right )}{105 \cos \left (d x +c \right )^{3}}\right )+\frac {2 a^{2}}{7 \cos \left (d x +c \right )^{7}}-a^{2} \left (-\frac {16}{35}-\frac {\left (\sec ^{6}\left (d x +c \right )\right )}{7}-\frac {6 \left (\sec ^{4}\left (d x +c \right )\right )}{35}-\frac {8 \left (\sec ^{2}\left (d x +c \right )\right )}{35}\right ) \tan \left (d x +c \right )}{d}\) \(121\)
default \(\frac {a^{2} \left (\frac {\sin ^{3}\left (d x +c \right )}{7 \cos \left (d x +c \right )^{7}}+\frac {4 \left (\sin ^{3}\left (d x +c \right )\right )}{35 \cos \left (d x +c \right )^{5}}+\frac {8 \left (\sin ^{3}\left (d x +c \right )\right )}{105 \cos \left (d x +c \right )^{3}}\right )+\frac {2 a^{2}}{7 \cos \left (d x +c \right )^{7}}-a^{2} \left (-\frac {16}{35}-\frac {\left (\sec ^{6}\left (d x +c \right )\right )}{7}-\frac {6 \left (\sec ^{4}\left (d x +c \right )\right )}{35}-\frac {8 \left (\sec ^{2}\left (d x +c \right )\right )}{35}\right ) \tan \left (d x +c \right )}{d}\) \(121\)
parallelrisch \(-\frac {2 a^{2} \left (21 \left (\tan ^{9}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-42 \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+28 \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+56 \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-42 \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-28 \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+76 \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-24 \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-3 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+6\right )}{21 d \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{3} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{7}}\) \(152\)

[In]

int(sec(d*x+c)^8*(a+a*sin(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

-16/21*I*a^2*(-8*I*exp(3*I*(d*x+c))+14*exp(4*I*(d*x+c))-4*I*exp(I*(d*x+c))+3*exp(2*I*(d*x+c))-1)/(-I+exp(I*(d*
x+c)))^7/(exp(I*(d*x+c))+I)^3/d

Fricas [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 115, normalized size of antiderivative = 1.40 \[ \int \sec ^8(c+d x) (a+a \sin (c+d x))^2 \, dx=-\frac {16 \, a^{2} \cos \left (d x + c\right )^{4} - 8 \, a^{2} \cos \left (d x + c\right )^{2} - 2 \, a^{2} - {\left (8 \, a^{2} \cos \left (d x + c\right )^{4} - 12 \, a^{2} \cos \left (d x + c\right )^{2} - 5 \, a^{2}\right )} \sin \left (d x + c\right )}{21 \, {\left (d \cos \left (d x + c\right )^{5} + 2 \, d \cos \left (d x + c\right )^{3} \sin \left (d x + c\right ) - 2 \, d \cos \left (d x + c\right )^{3}\right )}} \]

[In]

integrate(sec(d*x+c)^8*(a+a*sin(d*x+c))^2,x, algorithm="fricas")

[Out]

-1/21*(16*a^2*cos(d*x + c)^4 - 8*a^2*cos(d*x + c)^2 - 2*a^2 - (8*a^2*cos(d*x + c)^4 - 12*a^2*cos(d*x + c)^2 -
5*a^2)*sin(d*x + c))/(d*cos(d*x + c)^5 + 2*d*cos(d*x + c)^3*sin(d*x + c) - 2*d*cos(d*x + c)^3)

Sympy [F(-1)]

Timed out. \[ \int \sec ^8(c+d x) (a+a \sin (c+d x))^2 \, dx=\text {Timed out} \]

[In]

integrate(sec(d*x+c)**8*(a+a*sin(d*x+c))**2,x)

[Out]

Timed out

Maxima [A] (verification not implemented)

none

Time = 0.19 (sec) , antiderivative size = 98, normalized size of antiderivative = 1.20 \[ \int \sec ^8(c+d x) (a+a \sin (c+d x))^2 \, dx=\frac {{\left (15 \, \tan \left (d x + c\right )^{7} + 42 \, \tan \left (d x + c\right )^{5} + 35 \, \tan \left (d x + c\right )^{3}\right )} a^{2} + 3 \, {\left (5 \, \tan \left (d x + c\right )^{7} + 21 \, \tan \left (d x + c\right )^{5} + 35 \, \tan \left (d x + c\right )^{3} + 35 \, \tan \left (d x + c\right )\right )} a^{2} + \frac {30 \, a^{2}}{\cos \left (d x + c\right )^{7}}}{105 \, d} \]

[In]

integrate(sec(d*x+c)^8*(a+a*sin(d*x+c))^2,x, algorithm="maxima")

[Out]

1/105*((15*tan(d*x + c)^7 + 42*tan(d*x + c)^5 + 35*tan(d*x + c)^3)*a^2 + 3*(5*tan(d*x + c)^7 + 21*tan(d*x + c)
^5 + 35*tan(d*x + c)^3 + 35*tan(d*x + c))*a^2 + 30*a^2/cos(d*x + c)^7)/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 171 vs. \(2 (74) = 148\).

Time = 0.34 (sec) , antiderivative size = 171, normalized size of antiderivative = 2.09 \[ \int \sec ^8(c+d x) (a+a \sin (c+d x))^2 \, dx=-\frac {\frac {7 \, {\left (9 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 15 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 8 \, a^{2}\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1\right )}^{3}} + \frac {273 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{6} - 1155 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 2450 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} - 2870 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 2037 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 791 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 152 \, a^{2}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1\right )}^{7}}}{168 \, d} \]

[In]

integrate(sec(d*x+c)^8*(a+a*sin(d*x+c))^2,x, algorithm="giac")

[Out]

-1/168*(7*(9*a^2*tan(1/2*d*x + 1/2*c)^2 + 15*a^2*tan(1/2*d*x + 1/2*c) + 8*a^2)/(tan(1/2*d*x + 1/2*c) + 1)^3 +
(273*a^2*tan(1/2*d*x + 1/2*c)^6 - 1155*a^2*tan(1/2*d*x + 1/2*c)^5 + 2450*a^2*tan(1/2*d*x + 1/2*c)^4 - 2870*a^2
*tan(1/2*d*x + 1/2*c)^3 + 2037*a^2*tan(1/2*d*x + 1/2*c)^2 - 791*a^2*tan(1/2*d*x + 1/2*c) + 152*a^2)/(tan(1/2*d
*x + 1/2*c) - 1)^7)/d

Mupad [B] (verification not implemented)

Time = 6.55 (sec) , antiderivative size = 276, normalized size of antiderivative = 3.37 \[ \int \sec ^8(c+d x) (a+a \sin (c+d x))^2 \, dx=\frac {2\,a^2\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (6\,{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^9-3\,{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^8\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )-24\,{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^7\,{\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+76\,{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6\,{\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3-28\,{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5\,{\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4-42\,{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4\,{\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+56\,{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,{\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6+28\,{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,{\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^7-42\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,{\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^8+21\,{\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^9\right )}{21\,d\,{\left (\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )-\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}^7\,{\left (\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )+\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}^3} \]

[In]

int((a + a*sin(c + d*x))^2/cos(c + d*x)^8,x)

[Out]

(2*a^2*cos(c/2 + (d*x)/2)*(6*cos(c/2 + (d*x)/2)^9 + 21*sin(c/2 + (d*x)/2)^9 - 42*cos(c/2 + (d*x)/2)*sin(c/2 +
(d*x)/2)^8 - 3*cos(c/2 + (d*x)/2)^8*sin(c/2 + (d*x)/2) + 28*cos(c/2 + (d*x)/2)^2*sin(c/2 + (d*x)/2)^7 + 56*cos
(c/2 + (d*x)/2)^3*sin(c/2 + (d*x)/2)^6 - 42*cos(c/2 + (d*x)/2)^4*sin(c/2 + (d*x)/2)^5 - 28*cos(c/2 + (d*x)/2)^
5*sin(c/2 + (d*x)/2)^4 + 76*cos(c/2 + (d*x)/2)^6*sin(c/2 + (d*x)/2)^3 - 24*cos(c/2 + (d*x)/2)^7*sin(c/2 + (d*x
)/2)^2))/(21*d*(cos(c/2 + (d*x)/2) - sin(c/2 + (d*x)/2))^7*(cos(c/2 + (d*x)/2) + sin(c/2 + (d*x)/2))^3)